<template>
  <div class="container">
    <data-view
      propViewKey="dept_use_merge"
      propViewForm="dept/usemerge/detail.vue"
      :propFlowKey="propFlowKey"
      @extra-button-click="extraButtonClick"
      ref="dataview"
      :propIsTdesign="true"
    />
  </div>
</template>

<script>

export default {
  name: 'usemerge',
  data() {
    return {

    }
  },
  components: {

  },
  methods: {
    extraButtonClick(para) {
      let buttonKey = para.button.key
      if (buttonKey === 'auto_merge') {
        this.$confirm('将按照消耗科室、日期、门诊号或住院号进行合单，确定执行么?', '提示', {
          confirmButtonText: '确定',
          cancelButtonText: '取消',
          type: 'warning'
        }).then(() => {
          this.autoMergeOprtUse()
        }).catch(() => {
        })
      }
    },
    autoMergeOprtUse() {
      this.utilVue.loadShow(true)
      this.$ajax.get('/dept/use_merge/autoMergeOprtUseMain').then(resp => {
        this.utilVue.loadHide()
        if (resp.code === 0) {
          this.utilMessage.success(resp.msg)
        }
        this.$refs.dataview.ocRefresh()
      })
    }
  },
  props: ['propFlowKey'],
}
</script>

<style lang="scss" scoped>
  .container {
    height: 100%;
    background-color: #fff;
  }
</style>
